package com.gps.pe.mock.examples;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

import com.gps.pe.base.api.AbstractPlacementEngineController;
import com.gps.pe.exception.PeException;
import com.gps.pe.model.Role;
import com.gps.pe.service.IRoleService;
import com.gps.pe.service.RoleService;

/**
 * Test mock up controller class for URL - /testMyRoleController
 * 
 * @author GPS
 *
 */
public class TestRoleMyController extends AbstractPlacementEngineController {
	private static final Logger LOGGER = Logger.getLogger(TestRoleMyController.class);

	@Override
	public void execute(HttpServletRequest req, HttpServletResponse resp) throws PeException {
		LOGGER.info("Testing Role Service for test Controller...");
		IRoleService roleService = new RoleService();
		Role role = roleService.getRoleById(1);

		if (role != null) {
			LOGGER.debug("Role details [" + role.toString() + "] for RoleId [1]");
		} else {
			LOGGER.debug("Role not found for roleId [1]");
		}
	}
}
